<template>
  <div class="page">
    <el-pagination
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page="currentPage"
      :page-sizes="[10, 20, 30, 40]"
      :page-size="10"
      layout="total, sizes, prev, pager, next, jumper"
      :total="Number(total)"
    ></el-pagination>
  </div>
</template>

<script>
export default {
  props:{
    total: {
      default: 0,
      type:Number | String
    },
  },
  data() {
    return {
      currentPage:1,
      size:10,
      page:1
    }
  },
  methods: {
    handleSizeChange(val) {
      // console.log(`每页 ${val} 条`);
      this.size = val
      this.$emit('page',this.page,this.size)
    },
    handleCurrentChange(val) {
      this.page = val
      // console.log(`当前页: ${val}`);
      this.$emit('page',this.page,this.size)
    }
  }
};
</script>

<style scoped lang="css">
</style>
